package com.weimei.conversionTreasure.adapter;

import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.weimei.conversionTreasure.R;


public class GDTjAdapter extends BaseQuickAdapter<GDTjAdapter.TjBean, BaseViewHolder> {
    public GDTjAdapter() {
        super(R.layout.item_tj);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, TjBean tjBean) {
        holder.setText(R.id.tv_jj,"基酒"+(getItemPosition(tjBean)+1));

        ((EditText)holder.getView(R.id.edt_jiudu)).addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {
                tjBean.setDegree(s.toString());
            }
        });

        ((EditText)holder.getView(R.id.edt_tj)).addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {
                tjBean.setQuality(s.toString());
            }
        });

        ((EditText)holder.getView(R.id.edt_unit)).addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {
                tjBean.setPrice(s.toString());
            }
        });
    }

    public static class TjBean{
        private String degree;
        private String quality;
        private String price;

        public String getDegree() {
            return degree;
        }

        public void setDegree(String degree) {
            this.degree = degree;
        }

        public String getQuality() {
            return quality;
        }

        public void setQuality(String quality) {
            this.quality = quality;
        }

        public String getPrice() {
            return price;
        }

        public void setPrice(String price) {
            this.price = price;
        }
    }
}
